<?php
set_time_limit(0);
if (isset($_POST['op']) && isset($_POST['tm'])){
    include '../c/config.php';
    $openid=trim($_POST['op']);
    $rand=rand(1,3);
    if(1 == $rand){
        $dbhost='121.41.216.144';
    }
    if(2 == $rand){
        $dbhost='121.41.221.25';
    }
    //file_put_contents('../data/tm/'.$id.'-dan.txt', json_encode($_POST['tm'], JSON_UNESCAPED_UNICODE));

    $mysqli = new mysqli($dbhost, $dbuser, $dbpwd, $dbName);
    //if (!$mysqli->set_charset("utf8")) {printf("Error loading character set utf8: %s\n", $mysqli->error);}
    
    
    $mysqli->query("INSERT INTO `danxuan` (`id`, `uid`, `yhtj`,`createtime`) VALUES (NULL,'".$openid."', '".json_encode($_POST['tm'], JSON_UNESCAPED_UNICODE)."', '".date("Y-m-d H:i:s")."')");
    $mysqli->close();
    echo json_encode(array('s'=>'y'));
}else{
    echo json_encode(array('s'=>'n'));
}

?>